<template>
	<view>
		<!--发布日记-->
		<view style="padding-bottom: 20px;">
			
			术后第0天-----------------------------{{diaryTime}}
		</view>	
		
		<!--文本输入框-->
		<view style="padding-bottom: 320px;">
			<uni-section title="多行文本自动高度" subTitle="使用属性 autoHeight 使多行文本框自动增高" type="line" padding>
				<uni-easyinput type="textarea" autoHeight v-model="diaryContent" placeholder="记录变美每一天,说说你此刻的感受"></uni-easyinput>
			</uni-section>
		</view>
		<!--添加图片-->
		<uni-section title="只选择图片" type="line">
			<view >
				<uni-file-picker limit="9" title="已添加0张图片">
				<image src="../../static/tabBar/fbhei.png" style="width:50px; height:50px;padding-left: 8px;"></image>
				</uni-file-picker>	
			</view>
		</uni-section>
		<button @click="add">发布</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
			
				diaryTime:'',
			}
		},
		onLoad() {
			this.list()
		},
		
		methods: {
			add() {
			uni.request({
				url:'http://localhost:8090/contents/diary/addRelease',
				method: 'post',
				dataType:'json',
				data:{
					diaryContent:this.diaryContent,
					diaryTime:this.diaryTime
				} }).then(res => {
					console.log(this.diaryContent,this.diaryTime)	
				})
			},
			list(){
				uni.request({
						url: 'http://localhost:8090/contents/diary/selectTime',
						method: 'get',
						dataType: 'json',
						success: (res) => {
							this.diaryTime = res.data.data.data
						}
					})
				},
			}
	}
</script>

<style lang="scss">
		.uni-mt-5{
			margin-left: 50px;
		}
</style>